using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class Recruiters_search : System.Web.UI.Page
{
    string connectionString = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        
        try
        {
            if (Session.Contents["rcuserid"] == null)
            {
                Response.Redirect("login.aspx");
            }
            if (Session["rcactivate"].ToString() == "False")
            {

                btnSearch.Enabled = false;
                literalError.Text = "<font color=red><img border=0 src='/icons/warning.gif'>You can not search resume, <br>because this account is not approved by management team.</font>";
            }
            connectionString =
            WebConfigurationManager.ConnectionStrings[
            "RecruitVietnam"].ConnectionString;
            RegisterJavaScript();
            if (!IsPostBack)
            {
                LoadDataForDropDownList();
            }
        }
        catch (Exception ex)
        {
            literalError.Text = ex.Message;
        }
    }
    void LoadDataForDropDownList()
    {
        Common cls = new Common(connectionString);
        DataSet dataSet = cls.GetDataSet(
        "select * from tblJobCategories; " +
        "Select * from tblJobIndustries;" +
          "select * from tblProvinces;"+
         " select * from tblJSCertificates;"+
         "select * from tblExperienceLevel;" +
         "select * from tblWorkingTypes");
        DropDownListHelper helper =
        new DropDownListHelper();
        helper.FillDataTableToDropDownList(
        dataSet, new DropDownList[6] { 
        jobCategory, jobIndustry, provinceName, qualificationName, workingLevel, workingType },
        new string[6]{"JobCategoryName", 
            "JobIndustryName","ProvinceName", "CertificateName", "ExperienceLevelName", "WorkingTypeName"},
        new string[6]{"JobCategoryID", 
            "JobIndustryID","ProvinceID", "CertificateID", "ExperienceLevelID", "WorkingTypeID"},
        new string[6] { "", "", "", "", "", "" });
    }
    void RegisterJavaScript()
    {
        string javaScript =
        "function ShowAdvanced(obj){" +
        "var type='block';" +
        " if(obj.value=='[Basic]')" +
        "{type='none';obj.value='[More options]';}" +
        " else {type='block';obj.value='[Basic]';}";
        javaScript += "document.getElementById(\"" +
        "trCategory\").style.display=type;";
        javaScript += "document.getElementById(\"" +
        "trProvince\").style.display=type;";
        javaScript += "document.getElementById(\"" +
       "trWorkType\").style.display=type;";
        javaScript += "document.getElementById(\"" +
       "trWorkLevel\").style.display=type;";
        javaScript += "document.getElementById(\"" +
        "trIndustry\").style.display=type;" +
        "return false;}";
        ClientScript.RegisterClientScriptBlock(
        this.GetType(), "AdvancedSearch",
        javaScript, true);
    }
}
